
export default class Car {

    x = 1000
    y = 400
    xSpeed = -20
    ySpeed = 0
    sprite: Laya.Sprite = new Laya.Sprite()
    scene: Laya.Scene = null
    width = 200
    height = 50


    constructor(scene: Laya.Scene) {
        this.scene = scene
        scene.addChild(this.sprite)
        this.sprite.graphics.drawRect(this.x,
            this.y, this.width, this.height, "#ffff00")
    }
    framework() {
        // console.log('hhhh');
        if (this.x < -200) {
            this.xSpeed = -6 + Math.random() * -20;
            this.x = 1000
        }
        this.x += this.xSpeed

        this.sprite.graphics.clear()
        this.sprite.graphics.drawRect(this.x,
            this.y, this.width, this.height, "#ffff00")
    }
    atThere() {

    }

}